-
Notifications
You must be signed in to change notification settings - Fork 6
collapse sidebar on home page to keep focus on content, other pages have it open #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // Get the current pathname to determine initial sidebar state | ||
| const headersList = await headers(); | ||
| const pathname = headersList.get("x-pathname") || ""; | ||
| const isHomePage = pathname.endsWith("/home"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need check on ssr if we are on the homepage or not to start with the sidebar collapsed or not, otherwise you see a jank animation post-pageload.
|
@sdserranog any idea why the build might be failing here? |
|
To be honest, I am not a fan of this solution. We could make some improvements, like creating a custom hook instead of a component and importing it only on the home page, so we don't need to track the pathname in each component and page. However, I don't think it's worth it, the sidebar doesn't look bad on this page, and I believe the main feature was collapsing the sidebar and opening it on hover. We can discuss it, or not, and I'm ok with the changes if we feel strongly about this. |
|
I defer to @vfanelle who was the one who wanted the sidebar hidden. I'll close this PR either way, because with the layout changes this would have to change dramatically |
I'm emulating clicks to trigger the animations.